import React, { Component } from 'react';
import {
    View,
    StyleSheet,
    RefreshControl,
    Dimensions,
    Platform,
} from 'react-native';
import {
    Container,
    Content,
    Left,
    Thumbnail,
    Text,
    Body,
    Icon,
    List,
    ListItem,
    Right,
    Switch,

} from 'native-base';
import { connect } from 'react-redux';
import STRING from '../../const_string_zh_CN';
import { NavigationActions } from 'react-navigation';
const { width, height } = Dimensions.get('window');
const marginTop = Platform.OS === 'ios' ? 20 : 0;
 class discovery_tab_page extends Component {
    constructor(props) {
        super(props);
        //state内部维护的一个状态，我们刚开始进来的为空，来加载空的view
        this.state = {
            text: '上课',  
        };
    }
    render() {
         const{navigate} =this.props.navigation;
          const { login_info_role } = this.props;
         console.log('TABME发现模块');
         console.log(login_info_role);
        if(login_info_role.customRole=='teacher'){
            return (
          <Container style={StyleSheet.flatten(styles.Container)} >
            <Content refreshControl={<RefreshControl refreshing={false} />} scrollEnabled={true}>
              
                     <List >                   
                          {/*<ListItem  onPress={() => {
                              
                               navigate('DiscoveryInteract', { title:'课程列表' ,name:'储相瑞'});   
                              
                              }} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='ios-shuffle' />
                                  <Body>
                                      <Text style={StyleSheet.flatten(styles.text_style)}>{STRING.interact}</Text>                                     
                                  </Body>
                                  <Thumbnail square size={20} style={StyleSheet.flatten(styles.nextIcon)} source={require('../../images/back.png')} />
                          </ListItem>*/}
                          {/*<ListItem  style={StyleSheet.flatten(styles.ListItem)}>*/}
                          <ListItem onPress={() => {navigate('OnlineStatisticsStudentNow', { title:STRING.online_statistics_now_student});}} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='calculator'  />
                                  <Body>
                                      <Text style={StyleSheet.flatten(styles.text_style)}>{STRING.online_statistics_now_student}</Text>                                     
                                  </Body>
                            <Thumbnail square size={20} style={StyleSheet.flatten(styles.nextIcon)} source={require('../../images/back.png')} />
                          </ListItem>
                          <ListItem onPress={() => {navigate('OnlineStatisticsStudentBefore', { title:STRING.online_statistics_before_student });}} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='ios-paper-outline'  />
                                  <Body>
                                      <Text style={StyleSheet.flatten(styles.text_style)}>{STRING.online_statistics_before_student}</Text>                                     
                                  </Body>
                            <Thumbnail square size={20} style={StyleSheet.flatten(styles.nextIcon)} source={require('../../images/back.png')} />
                          </ListItem>
                          {/*<ListItem onPress={() => {navigate('DiscoveryInteractStudent');}} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='ios-shuffle'  />
                                  <Body>
                                      <Text style={StyleSheet.flatten(styles.text_style)}>交互（学生端）</Text>                                     
                                  </Body>
                            <Thumbnail square size={20} style={StyleSheet.flatten(styles.nextIcon)} source={require('../../images/back.png')} />
                          </ListItem>*/}
                          {/*<ListItem onPress={() =>this.setState({ text: '下课'})} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='ios-paper-outline'  />
                                      <Text style={StyleSheet.flatten(styles.text_style)}>{this.state.text}</Text>                                     
                          </ListItem>*/}
                     </List>
                           
            </Content>
            </Container>
        );
    } 
    else{
        return (
          <Container style={StyleSheet.flatten(styles.Container)} >
            <Content refreshControl={<RefreshControl refreshing={false} />} scrollEnabled={true}>
                     <List >                   
                          <ListItem onPress={() => {
                                navigate('CunrrentTermCourseList', { title:'当前学期课程列表'});  
                              }} style={StyleSheet.flatten(styles.ListItem)}>
                             <Icon name='ios-hand-outline' />
                                  <Body>
                                      <Text style={StyleSheet.flatten(styles.text_style)}>{STRING.sign}</Text>                                     
                                  </Body>
                                  <Thumbnail square size={20} style={StyleSheet.flatten(styles.nextIcon)} source={require('../../images/back.png')} />
                          </ListItem>
                   
                         
                     </List>
                           
            </Content>
            </Container>
        );

    }
    }
}
const styles = StyleSheet.create({
    card_style: {
        backgroundColor:'white',  
    },
    text_style:{
      //fontFamily:'微软雅黑',
      fontSize:17,
      color:'#353535',
    },
     nextIcon: {
        width: 20,
        height: 20,
        marginRight: 20,  
        opacity:0.8,
    }, 
    Container : {
        marginTop: 12, 
       // backgroundColor:'white',   
    },
     ListItem : {
       marginRight: 0,
        marginLeft: 0,
        marginTop: 3,
        //height:40,
        paddingBottom:10,
        paddingLeft:20,
        paddingRight:20,
        backgroundColor:'white',
        //borderBottomWidth:0.5,
       // borderBottomColor:"#cac0c0",
        //borderTopColor:"#cac0c0",
       // borderTopWidth:0.5,
       
    },
});
function mapStateToProps(state) {
    return {
        login_info_role: state.login.login_info
    }
}

function mapDispatchToProps(dispatch) {
    return {
    }
}

const DiscoveryTabPage = connect(
    mapStateToProps,
    mapDispatchToProps
)(discovery_tab_page)

export default DiscoveryTabPage;
